﻿<UserControl x:Class="PokemonBattleOnline.PBO.Lobby.RoomView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:ui="clr-namespace:PokemonBattleOnline.PBO.Elements"
             xmlns:c="clr-namespace:PokemonBattleOnline.PBO.Converters">
    <Grid>
        <Grid.Resources>
            <Style TargetType="ContentControl" x:Key="UserL">
                <Setter Property="Height" Value="32"/>
                <Setter Property="Width" Value="128"/>
                <Setter Property="HorizontalAlignment" Value="Left"/>
                <Setter Property="ContentTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <Grid x:Name="grid" Background="Transparent" IsHitTestVisible="False">
                                <Image Source="{Binding Avatar,Converter={x:Static c:IdAvatar.C}}" Height="32" Width="32" HorizontalAlignment="Left"/>
                                <TextBlock Text="{Binding Name}" Foreground="{Binding Name,Converter={x:Static c:UserColor.C}}" Margin="35,2,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                <TextBlock x:Name="n" Text="等待玩家" Visibility="Collapsed" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Grid>
                            <DataTemplate.Triggers>
                                <DataTrigger Binding="{Binding}" Value="{x:Null}">
                                    <Setter TargetName="n" Property="Visibility" Value="Visible"/>
                                    <Setter Property="Cursor" Value="Hand"/>
                                    <Setter TargetName="grid" Property="IsHitTestVisible" Value="True"/>
                                </DataTrigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter TargetName="grid" Property="Background" Value="#80ffffff"/>
                                </Trigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="ContentControl" x:Key="UserR">
                <Setter Property="Height" Value="32"/>
                <Setter Property="Width" Value="128"/>
                <Setter Property="HorizontalAlignment" Value="Right"/>
                <Setter Property="ContentTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <Grid x:Name="grid" Background="Transparent" IsHitTestVisible="False">
                                <Image Source="{Binding Avatar,Converter={x:Static c:IdAvatar.C}}" Height="32" Width="32" HorizontalAlignment="Right"/>
                                <TextBlock Text="{Binding Name}" Foreground="{Binding Name,Converter={x:Static c:UserColor.C}}" Margin="0,2,35,0" HorizontalAlignment="Right" VerticalAlignment="Center"/>
                                <TextBlock x:Name="n" Text="等待玩家" Visibility="Collapsed" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Grid>
                            <DataTemplate.Triggers>
                                <DataTrigger Binding="{Binding}" Value="{x:Null}">
                                    <Setter TargetName="n" Property="Visibility" Value="Visible"/>
                                    <Setter Property="Cursor" Value="Hand"/>
                                    <Setter TargetName="grid" Property="IsHitTestVisible" Value="True"/>
                                </DataTrigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter TargetName="grid" Property="Background" Value="#80ffffff"/>
                                </Trigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="Line">
                <Setter Property="Y2" Value="11"/>
                <Setter Property="IsHitTestVisible" Value="False"/>
                <Setter Property="StrokeThickness" Value="2"/>
                <Setter Property="Stroke" Value="#80f0ffff"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
                <Setter Property="Margin" Value="1,0,0,0"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Settings.Mode}" Value="Multi">
                        <Setter Property="Y2" Value="27"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </Grid.Resources>
        <Rectangle MouseLeftButtonDown="Watch_Click" StrokeThickness="2" Stroke="#80f0ffff" Cursor="Hand" ToolTip="观战">
            <Rectangle.Style>
                <Style TargetType="Rectangle">
                    <Setter Property="Fill" Value="#40ffffff"/>
                    <Style.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Fill" Value="#80ffffff"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Rectangle.Style>
        </Rectangle>
        <Ellipse IsHitTestVisible="False" Height="10" Width="10" Stroke="#80f0ffff" StrokeThickness="2"/>
        <Ellipse IsHitTestVisible="False" Height="20" Width="20" Stroke="#80f0ffff" StrokeThickness="2"/>
        <Line VerticalAlignment="Top"/>
        <Line VerticalAlignment="Bottom"/>
        <ContentControl Content="{Binding [0]}" Style="{StaticResource UserL}" MouseLeftButtonDown="P00_Click" HorizontalAlignment="Left" VerticalAlignment="Top"/>
        <ContentControl Content="{Binding [2]}" Style="{StaticResource UserR}" MouseLeftButtonDown="P10_Click" HorizontalAlignment="Right" VerticalAlignment="Top"/>
        <Grid Name="PX1" Margin="0,32,0,0" Height="32">
            <ContentControl Content="{Binding [1]}" Style="{StaticResource UserL}" MouseLeftButtonDown="P01_Click" HorizontalAlignment="Left"/>
            <ContentControl Content="{Binding [3]}" Style="{StaticResource UserR}" MouseLeftButtonDown="P11_Click" HorizontalAlignment="Right"/>
            <Grid.Style>
                <Style TargetType="Grid">
                    <Setter Property="Visibility" Value="Collapsed"/>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Settings.Mode}" Value="Multi">
                            <Setter Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>
        </Grid>
        <!--<TextBlock Text="VS" FontWeight="Bold" Foreground="#333333" HorizontalAlignment="Center" VerticalAlignment="Center"/>-->
    </Grid>
</UserControl>
